<%= form_for(portfolio_item) do |f| %>
  <% if portfolio_item.errors.any? %>
    <% portfolio_item.errors.full_messages.each do |error| %>
      <%= alert_generator error %>
    <% end %>
  <% end %>

  <div class="row portfolio-form">
    <div class="col-md-6">
      <div class="form-group">
        <b><%= f.label :title %></b>
        <%= f.text_field :title, class: "form-control" %>
      </div>

      <div class="form-group">
        <b><%= f.label :subtitle %></b>
        <%= f.text_field :subtitle, class: "form-control" %>
      </div>

      <div class="custom-file">
        <input type="file" class="custom-file-input" id=<%= f.file_field :main_image %>
        <label class="custom-file-label" for="validatedCustomFile">Upload a main image file...</label>
      </div>

      <br>
      <br>

      <div class="custom-file">
        <input type="file" class="custom-file-input" id=<%=f.file_field :thumb_image %>
        <label class="custom-file-label" for="validatedCustomFile">Upload a thumb image file...</label>
      </div>

    </div>
    <div class="col-md-6">
      <div class="form-group">
        <b><%= f.label :body %></b>
        <%= f.text_area :body, class: "form-control", rows: 12 %>
      </div>
    </div>
  </div>
  <hr>
    <div class="col-md-6">
      <h3>Technologies Used:</h3>
      <div>
        <%= f.fields_for :technologies do |technology_form| %>
        <%= render 'technology_fields', f: technology_form %>
        <% end %>
        <div><%= link_to_add_association "Add Technology", f, :technologies %></div>
      </div>

      <div class="form-group">
        <%= f.submit "Submit", class: "btn btn-primary" %>
      </div>
    </div>
<% end %>
